# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     setting.py
   Description :   配置文件
   Author :        JHao
   date：          2019/2/15
-------------------------------------------------
   Change Activity:
                   2019/2/15:
-------------------------------------------------
"""

import sys
from os import getenv
from logging import getLogger

log = getLogger(__name__)

# 代理池数据库配置
REDIS_HOST = getenv("REDIS_HOST", "redis")
REDIS_PORT = getenv("REDIS_PORT", "6379")
REDIS_PASSWORD = getenv("REDIS_PASSWORD", "")
REDIS_KEY = getenv("REDIS_KEY", "proxies:universal")
REDIS_DB = getenv("REDIS_DB", 0)

# 代理池配置
PROXY_FETCHER = [
    "freeProxy01",
    "freeProxy02",
    "freeProxy03",
    "freeProxy04",
    "freeProxy05",
    "freeProxy06",
    "freeProxy07",
    "freeProxy08",
    "freeProxy09",
    "freeProxy10"
]

# 校验器配置
HTTP_URL = getenv("HTTP_URL", "http://httpbin.org/get")
HTTPS_URL = getenv("HTTPS_URL", "https://httpbin.org/get")
VERIFY_TIMEOUT = getenv("VERIFY_TIMEOUT", 10)

# API配置
SERVER_API = {
    "host": getenv("SERVER_API_HOST", "0.0.0.0"),
    "port": getenv("SERVER_API_PORT", "5010")
}

# 循环周期
CYCLE_GETTER = getenv("CYCLE_GETTER", 100)
CYCLE_TESTER = getenv("CYCLE_TESTER", 20)

# 代理质量
# 检查代理设置
VERIFY_RUL = getenv("VERIFY_URL", "http://httpbin.org/get")
VERIFY_REGEX = getenv("VERIFY_REGEX", "Origin")
# 代理数量界限
POOL_SIZE_MIN = getenv("POOL_SIZE_MIN", 10)
POOL_SIZE_MAX = getenv("POOL_SIZE_MAX", 200)
# 检查周期
VERIFY_CYCLE = getenv("VERIFY_CYCLE", 60)
# 检查时间间隔
VERIFY_TIMEOUT = getenv("VERIFY_TIMEOUT", 10) 